<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/cookie.js"></script>
</head>

<body>
    <button class="set">创建</button>
    <button class="get">获取</button>
    <button class="edit">修改</button>
</body>
<script>

    // 如何修改cookie
    // 1. cookie是以键值对形成存在的(字符串) => 对应键名修改   没有就新增 有就覆盖


    var set = document.getElementsByClassName("set")[0];
    var get = document.getElementsByClassName("get")[0];
    var edit = document.getElementsByClassName("edit")[0];

    set.onclick = function () {
        setCookie("user", "a123123", 31 * 24 * 60 * 60);
        setCookie("pwd", "123123", 31 * 24 * 60 * 60);
        setCookie("phone", "17386141517");
        setCookie("email", "1272071495@qq.com");
    }


    get.onclick = function () {


        console.log(getCookie("user"));
        console.log(getCookie("pwd"));
        console.log(getCookie("phone"));
        console.log(getCookie("email"));
        console.log(getCookie("age"));
    }

    edit.onclick = function () {
        setCookie("user", "b123123", 31 * 24 * 60 * 60);
        setCookie("pwd", "321323", 31 * 24 * 60 * 60);
        setCookie("phone", "17386171514", 31 * 24 * 60 * 60);
        setCookie("email", "1272076666@qq.com", 31 * 24 * 60 * 60);
    }


</script>

</html>